package org.gpp.proj1.demo.particle;

import org.gpp.proj1.particle.ParticleCreator;

import com.jme.app.AbstractGame;
import com.jme.app.SimpleGame;
import com.jme.math.Vector3f;
import com.jme.scene.Node;

/**
 * Classe para testar visualmente (n�o-automaticamente) o comportamento
 * da Factory de part�culas.
 * @author Gustavo de Farias
 */
public class ParticleFactoryVisualTest extends SimpleGame {

	/**
	 * @see com.jme.app.BaseSimpleGame#simpleInitGame()
	 */
	@Override
	protected void simpleInitGame() {
		
		// Cria 3 n�s.
		Node node2 = new Node("2");
		Node node3 = new Node("3");

		// Adiciona um TriMesh de part�cula a cada n�.
		node2.attachChild(ParticleCreator.createParticle("res/particle/fire.jme"));
		node3.attachChild(ParticleCreator.createParticle("res/particle/smoke.jme"));

		// Afasta os n�s uns dos outros.
		node2.setLocalTranslation(new Vector3f(-140, 0, 0));
		node3.setLocalTranslation(new Vector3f(140, 0, 0));
	
		// Adiciona cada n� ao n� principal.
		this.rootNode.attachChild( node2 );
		this.rootNode.attachChild( node3 );

		// Diminui a escala.
		this.rootNode.setLocalScale(0.1f);

		// Afasta a c�mera do centro
		this.cam.setLocation(new Vector3f(0, 15, 50));
	}
	
	/**
	 * Inicia o SimpleGame.
	 * @param args
	 */
	public static void main(String[] args) {
		ParticleFactoryVisualTest app = new ParticleFactoryVisualTest();
		app.setDialogBehaviour(AbstractGame.FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
		app.start();
	}
}
